package com.hdl.service;

import java.util.List;

import com.hdl.dto.ArticleSearch;
import com.hdl.entity.Article;
import com.hdl.exception.CodeException;
import com.hdl.vo.ArticleVO;
import com.hdl.vo.PageVO;
/**
 * <pre>
 * - 文章业务逻辑接口
 * ClassName : com.hdl.service.ArticleService
 * @author 湛锋
 * Date : 2020-8-18 16:22:29
 * </pre>
 */
public interface ArticleService {
	
	/**
	 * 
	 * @param search
	 * @return
	 * @throws CodeException 550文章总数查找失败
	 */
	long countBySearch(ArticleSearch search)throws CodeException;
	
	/**
	 * 
	 * @param search
	 * @return
	 * @throws CodeException 551文章分页查询失败
	 */
	PageVO<ArticleVO> selectSearch(ArticleSearch search,Integer current, Integer rowMax)throws CodeException;

	/**
	 * 添加一个新的文章
	 * @param article
	 * @return
	 * @throws CodeException 552:添加文章错误
	 */
	int add(Article article)throws CodeException;
	
	/**
	 * 根据文章编号修改文章
	 * @param article
	 * @return
	 * @throws CodeException 553:修改文章错误
	 */
	int update(Article article)throws CodeException;
	
	/**
	 * - 根据id来查看文章
	 * @param id
	 * @return
	 * @throws CodeException 554：查看文章失败
	 */
	Article selectById(Long id)throws CodeException;
	
	/**
	 * - 根据主键来删除文章
	 * @param id
	 * @return
	 * @throws CodeException 555：文章删除失败
	 */
	int deleteById(Long id)throws CodeException;
	
	/**
	 * - 根据主键来查找上一篇
	 * @param articleId
	 * @return
	 * @throws CodeException 556：查看上一篇文章失败
	 */
	Article selectPrevious(Long articleId)throws CodeException;
	
	/**
	 * - 根据主键来查找下一篇
	 * @param articleId
	 * @return
	 * @throws CodeException 557：查看下一篇文章失败
	 */
	Article selectNext(Long articleId)throws CodeException;
}
